#include <iostream>

using namespace std;
//初始化列表:C++提供了初始化列表语法，用来初始化属性
//语法:构造函数(): 属性1(值1),属性2(值2)

class Person {
public:
    int age;
    int high;
    int score;

    Person() : age(10), high(20), score(30) {
        cout << "默认构造函数的调用!" << endl;
    }

    //传统初始化操作
    Person(int age, int high, int score) : age(age), high(high), score(score) {
        cout << "有参构造函数的调用!" << endl;
    }

    Person(const Person &person) {
        this->age = person.age;
        this->high = person.high;
        this->score = person.score;
        cout << "拷贝构造函数的调用!" << endl;
    }

    ~Person() {
        cout << "析构函数的调用!" << endl;
    }
};

void test() {
    Person person1;
    cout << "person1:age=" << person1.age << ",high=" << person1.high << ",score=" << person1.score << endl;
    Person person2(18, 30, 90);
    cout << "person2:age=" << person2.age << ",high=" << person2.high << ",score=" << person2.score << endl;
}

int main() {
    test();
    return 0;
}